package easy.trace;

import java.io.Serializable;

public class Endpoint implements Serializable {
    private String ip;
    private Integer port;

    public Endpoint() {
    }

    public Endpoint(String ip, Integer port) {
        this.ip = ip;
        this.port = port;
    }

    public String getIp() {
        return this.ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public Integer getPort() {
        return this.port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String toString() {
        return "Endpoint{ip='" + this.ip + '\'' + ", port=" + this.port + '}';
    }

    public boolean equals(Object o) {
        if (this == o) {
            return true;
        } else if (!(o instanceof Endpoint)) {
            return false;
        } else {
            Endpoint endpoint = (Endpoint)o;
            if (!this.ip.equals(endpoint.ip)) {
                return false;
            } else {
                return this.port.equals(endpoint.port);
            }
        }
    }

    public int hashCode() {
        int result = this.ip.hashCode();
        result = 31 * result + this.port.hashCode();
        return result;
    }
}
